package com.sqx.modules.goods.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.sqx.modules.order.entity.Evaluate;
import com.sqx.modules.goods.entity.Goods;
import com.sqx.modules.goods.entity.GoodsShop;
import com.sqx.modules.goods.entity.GoodsShopRelevancy;
import com.sqx.modules.order.entity.TbOrder;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.math.BigDecimal;
import java.util.List;

@Mapper
public interface GoodsShopDao extends BaseMapper<GoodsShop> {

    IPage<GoodsShop> selectAllShop(Page<GoodsShop> pages,@Param("shopName") String shopName);

    IPage<GoodsShop> selectAllShopByAdmin(Page<GoodsShop> pages,@Param("shopName") String shopName,@Param("userId") Long userId);

    IPage<Goods> selectAdminGoodsList(Page<Goods> pages,@Param("classifyId") Integer classifyId,
                                      @Param("goodsName") String goodsName,@Param("status") Integer status,@Param("shopId") Long shopId, @Param("shopName") String shopName);

    IPage<Goods> selectGoodsByShopId(Page<Goods> pages, @Param("shopId") Long shopId, @Param("goodsName") String goodsName,
                                     @Param("classifyId") Integer classifyId, @Param("status") Integer status);

    IPage<Goods> selectGoodsByNotShopId(Page<Goods> pages,@Param("shopId") Long shopId, @Param("goodsName") String goodsName);

    int addGoodsByShopId(@Param("goodsShopRelevancyList") List<GoodsShopRelevancy> goodsShopRelevancyList, @Param("date") String date);

    int deleteGoodsByShopId(@Param("shopId") Long shopId, @Param("goodsId") Long goodsId);

    int soldOutOrPutaway(@Param("shopId") Long shopId, @Param("goodsId") Long goodsId,@Param("status") Integer status);

    List<GoodsShop> selectListByAdmin(Long userId);

    int selectStoreCount(@Param("shopId") Long shopId,@Param("startTime") String startTime,@Param("endTime") String endTime);

    BigDecimal selectStoreMoney(@Param("shopId") Long shopId,@Param("startTime") String startTime,@Param("endTime") String endTime);

    IPage<TbOrder> selectStoreMessage(Page<TbOrder> pages, Long shopId, String startTime, String endTime, String orderNumber);

    IPage<GoodsShop> selectSearch(Page<GoodsShop> pages, String impotr, Double lng, Double lat, String city);

    IPage<GoodsShop> selectShop(Page<GoodsShop> pages, Integer screen, Integer shopTypeId, Double lng, Double lat, String city, String impotr);

    IPage<Evaluate> selectEvaluate(Page<Evaluate> pages, Long shopId, Integer grade);

    IPage<Evaluate> selectEvaluateByGoodsId(Page<Evaluate> pages, String goodsIds);

  //  IPage<GoodsShop> selectShopList(Page<GoodsShop> pages, String shopName, Integer status, Integer shopType);

    int addGoodsShopRelevancy(GoodsShopRelevancy goodsShopRelevancy);

    IPage<GoodsShop> selectShopList(Page<GoodsShop> pages, String shopName, Integer status, Integer shopType);

    BigDecimal shopAllEarnings(Long shopId);

    BigDecimal shopEarningsDay(Long shopId, String date);

    BigDecimal shopEarningsMonth(Long shopId, String date);

    BigDecimal allMoney(Long shopId, String startTime, String endTime);

    int selectCountOrder(Long shopId, String startTime, String endTime, Integer status);

    int allCount(Long shopId, String startTime, String endTime);

    BigDecimal orderMoney(Long shopId, String startTime, String endTime);

    int sumCountOrder(Long shopId, String startTime, String endTime);

    BigDecimal refundMoney(Long shopId, String startTime, String endTime);

    int putawayCount(Long shopId);

    int soldoutCount(Long shopId);

    GoodsShop selectGoodsList(Long shopId, Double lng, Double lat);

    int selectGoodReputation(Long shopId);

    int selectMediumReview(Long shopId);

    int selectNegativeComment(Long shopId);

    int deleteGoods(Long shopId, Long goodsId);

    int updateShopSales(Integer type,Integer goodsNum, Long shopId);

    void updateCashDeposit(Double money, Long shopId);

    void updateShopCashDeposit(Long shopId, BigDecimal money, Integer type);

    int insertGoodsShop(GoodsShop goodsShop);

}
